import type { App } from 'vue'
import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'

function setUp(app: App) {
  const queryClient = new QueryClient({
    defaultOptions: {
      queries: {
        // 窗口获取焦点时不重刷查询
        refetchOnWindowFocus: false,

        // 查询失败不再重试
        retry: false
      }
    }
  })

  app.use(VueQueryPlugin, { queryClient })
}

export default setUp
